{% extends 'common/panel.html' %}
{% block title %}{{instance.name}}{% endblock title %}
{% block panel %}

<script type="text/javascript" charset="utf-8">

    $('body').delegate( '.smp_info', 'mouseover', function(event) {
        //console.log('entering SMP mouseover event function...');
        id = $(this).attr('id');
        var text = "none";
        topRight = false;
        topMiddle = false;
        topLeft = false;
        switch(id) {
            //Beach Erosion
            case 'info_smp_beach_erosion_slope':
                topRight = true;
                text  = "The slope of the shoreline is relevant to beach erosion as those areas with greater slopes are often more prone to continued erosion than those areas with lesser slopes.<br><br>Reports average, minimum, and maximum slope within your SMP Characterization Site, based on USGS 30 meter National Elevation Dataset, 2011. ";
                break;
            case 'info_smp_beach_erosion_structures':
                topRight = true;
                text  = "The inclusion of overwater structures is important for beach erosion as some structures could disrupt beach sediment transport or increase the amount of erosion.<br><br>Reports number of overwater structures by type within your SMP Characterization Site, based on Overwater Structures layer, WA DNR, 2011.";
                break;
            case 'info_smp_beach_erosion_drift':
                topRight = true;
                text  = "The inclusion of drift cells, which represent the direction of longshore transport for water and sediment, can be used to determine direction of longshore sediment transport. Knowledge of longshore transport direction is important for determining where eroded sediment will be transport to, thus informing mitigation strategies.";
                break;
            case 'info_smp_beach_erosion_drift_areas':
                topMiddle = true;
                text  = "Reports the area of oyster tracts within your SMP Characterization Site, based on Aquatic Parcels, WA DNR, 2011.";
                break;
            case 'info_smp_beach_erosion_shoreline_modification':
                topLeft = true;
                text  = "Reports the area of oyster reserves within your SMP Characterization Site, based on Aquatic Parcels, WA DNR, 2011.";
                break;
            case 'info_smp_beach_erosion_exposure':
                topRight = true;
                text  = "The exposure of shoreline and nearshore represents the vulnerability of an area to erosion. The more exposed a shoreline, the more likely erosion could occur.<br><br>Reports percentage of exposed and very exposed nearshore areas (shoreline and estuaries) within your SMP Characterization Site, based on Nearshore Exposure layer, TNC, 2011.";
                break;
            case 'info_smp_beach_erosion_substrate_vegetation':
                topRight = true;
                text  = "The substrate of shoreline can control the rate of erosion; rocky or hard substrates are harder to erode than unconsolidated sediments like sand, gravel and muds. The presence of vegetation along a shoreline can help reduce the susceptibility to erosion.<br><br>Based on Nearshore Substrate and Nearshore Vegetation layers, TNC, 2011.";
                break;
            //Shoreline Use
            case 'info_smp_shoreline_use_landuse':
                topRight = true;
                text  = "The inclusion of current land use can help identify undeveloped shoreline parcels, redevelopment lots, and existing land uses that may conflict with proposed shoreline uses.<br><br>Based on 2010 Landuse, WA DoE, 2011.";
                break;                
            case 'info_smp_shoreline_use_infrastructure':
                topRight = true;
                text  = "Marine infrastructure can be important for considering future shoreline uses (along with current land use) to identify conflicts of public access, marinas, docks, etc with current land use.";
                break;
            case 'info_smp_shoreline_use_structures':
                topLeft = true;
                text  = "Based on Overwater Structures layer, WA DNR, 2011.";
                break;
            case 'info_smp_shoreline_use_public_access':
                topLeft = true;
                text  = "Based on Public Access Locations, WA DoE, 2011.";
                break;
            //Public Access
            case 'info_smp_public_access_landuse':
                topRight = true;
                text  = "Undeveloped land is important for determining future public access. Undeveloped parcels identified along stretches of shoreline without public access could be suggested to provide facilities for public beach and shoreline access.<br><br>Reports the land use area by type within your SMP Characterization Site, based on 2010 Landuse, WA DoE, 2011.";
                break;
            case 'info_smp_public_access_beach_access':
                topRight = true;
                text  = "Beach access data are important to identify current beach access locations and could be used to identify gaps in beach access, that is stretches of shoreline without public access.<br><br>Reports the type and description of all public access sites within your SMP Characterization Site, based on Public Access Locations, WA DoE, 2011.";
                break;
            //Aquaculture
            case 'info_smp_aquaculture_general_aquaculture':
                topRight = true;
                text  = "The use of oyster tracts and reserves provide a data foundation to help identify current oyster uses areas and any aquatic parcels for potential future uses.";
                break;
            case 'info_smp_aquaculture_oyster_tracts':
                topMiddle = true;
                text  = "Reports the area of oyster tracts within your SMP Characterization Site, based on Aquatic Parcels, WA DNR, 2011.";
                break;
            case 'info_smp_aquaculture_oyster_reserves':
                topMiddle = true;
                text  = "Reports the area of oyster reserves within your SMP Characterization Site, based on Aquatic Parcels, WA DNR, 2011.";
                break;
            case 'info_smp_aquaculture_commercial_aquaculture':
                topRight = true;
                text  = "Reports areas of commercial shellfish growing areas and locations of commercial shellfish harvest sites, based on data from  Washington Department of Health, 2011.";
                break;
            case 'info_smp_aquaculture_growing_areas':
                topMiddle = true;
                text  = "Reports the area of commercial shellfish growing areas by harvest status within your SMP Characterization Site, based on Commercial Growing Areas, WA DOH, 2011.";
                break;
            case 'info_smp_aquaculture_harvest_sites':
                topMiddle = true;
                text  = "Reports the presence and area of all commercial shellfish harvest sites within your SMP Characterization Site, based on Commercial Harvest Sites, WA DOH, 2011.";
                break;
        }
        if (topRight) {
            target_position = 'topLeft';
            tooltip_position = 'bottomLeft';
        } else if (topLeft) {
            target_position = 'topRight';
            tooltip_position = 'bottomRight';
        } else if (topMiddle) {
            target_position = 'topMiddle';
            tooltip_position = 'bottomMiddle';
        } else {
            target_position: 'rightMiddle';
            tooltip_position: 'leftMiddle';
        }
        if (text!='none') {
            $(this).qtip({
                content: text, 
                show: { 
                    delay: 0,
                    when: { event: 'mouseover' },
                    ready: true  //without this option, the browser hangs  
                },
                position: {
                    corner: {
                        target: target_position,
                        tooltip: tooltip_position
                    }
                },
                hide: { when: {event: 'mouseleave'} },
                style: { 
                    width: 320,
                    name: 'blue' 
                }
            });
            event.stopImmediatePropagation();  //prevents repeated calls to delegate during repeat visits 
            //(previously, when smp reports, for example, were re-visited, delegate would get called once for each re-visit that 
            // had taken place between application refreshes)
            //(initially, this repeat-call behavior occurred for all delegate calls until img classes were made specific to app)
        } 
    });             
    
    
</script>

<h1>
    <img src="/media/wmm/img/smp.png"/>
    <small><small>SMP Characterization </small></small>
    &nbsp;&nbsp;{{instance.name}}
</h1>
    <div class="tabs">
        <ul>
            <li><a href="#Inputs"><span>Attributess</span></a></li>
            <li><a href="#results"><span>Reports</span></a></li>
        </ul>
        <div id="Inputs">
            <ul class="metadata">
              {% if instance.user.first_name and instance.user.last_name %} 
                <li class="creator">Created By {{instance.user.first_name}} {{instance.user.last_name}}</li>
              {% else %}
                <li class="creator">Created By {{instance.user.username}}</li>
              {% endif %}
                <li class="created">Created {{instance.date_created|date:"d M, Y P"}}</li>
                <li class="modified">Modified {{instance.date_modified|date:"d M, Y P"}}</li>
                <br class="clear" />
            </ul>
            
            <h2>Area </h2>
                <p style="margin-bottom: 0px; margin-top: 5px;">{{instance.area_in_sq_miles|floatformat:1}} sq miles</p>              
            
            <h2>Objective Scores <small>(out of 100)</small>:</h2>
                {% if instance.conservation_score >= 0 %}
                <p style="margin-bottom: 0px; margin-top: 10px;">Conservation: {{instance.conservation_score}}</p>
                {% else %}
                <p style="margin-bottom: 0px; margin-top: 10px;"><i>Conservation: not yet unavailable</i></p>
                {% endif %}
                {% if instance.tidalenergy_score >= 0 %}
                <p style="margin-bottom: 0px; margin-top: 5px;">Tidal Energy: {{instance.tidalenergy_score}}</p>
                {% else %}
                <p style="margin-bottom: 0px; margin-top: 5px;"><i>Tidal Energy: not yet unavailable</i></p>
                {% endif %}
                {% if instance.waveenergy_score >= 0 %}
                <p style="margin-bottom: 0px; margin-top: 5px;">Wave Energy: {{instance.waveenergy_score}}</p>
                {% else %}
                <p style="margin-bottom: 0px; margin-top: 5px;"><i>Wave Energy: not yet unavailable</i></p>
                {% endif %}
                {% if instance.windenergy_score >= 0 %}
                <p style="margin-bottom: 0px; margin-top: 5px;">Wind Energy: {{instance.windenergy_score}}</p>
                {% else %}
                <p style="margin-bottom: 0px; margin-top: 5px;"><i>Wind Energy: not yet unavailable</i></p>
                {% endif %}                                  
                
            <h2>Description</h2>
                {% if instance.description %}
                <p>{{instance.description}}</p>
                {% else %}
                <p><i>No Description</i></p>
                {% endif %}
                
            <h2>Next Steps</h2>
            <div class="draghint" style="width:95%; font-size:11px;">
                <table>
                    <tr>
                        <td style="vertical-align:top;"><img src="{{MEDIA_URL}}wmm/img/analysis_dragdrophint.png" /></td>
                        <td style="vertical-align:top;"><p style="margin-top:0px;margin-left:0px;">To view Tradeoff Analysis on the conservation and renewable energy scores for your SMP sites:
                            <ol style="padding-left:20px;">
                                <li>1. Create a Tradeoff Collection
                                <li>2. Add your SMP Sites to this collection (drag/drop)
                                <li>3. View the collection's attributes
                                <li>4. Select Multi-Objective Tradeoffs
                            </ol>
                        </td>
                    </tr>
                </table>
                <br style="clear:both;" />
            </div>
        </div>
        
        <div id="results" class="tabs">
            <ul>
                <li><a href="#WindEnergy_Instructions"><span>Instructions</span></a></li>
                <li><a href="{% url smp_analysis instance.pk 'beach_erosion' %}"><span>Beach Erosion</span></a></li>
                <li><a href="{% url smp_analysis instance.pk 'shoreline_use' %}"><span>Shoreline Use</span></a></li>
                <li><a href="{% url smp_analysis instance.pk 'public_access' %}"><span>Public Access</span></a></li>
                <li><a href="{% url smp_analysis instance.pk 'aquaculture' %}"><span>Aquaculture</span></a></li>
            </ul>
            <div id="WindEnergy_Instructions">
                <h3>SMP Characterization Site Reports</h3>
                <p><strong>Beach Erosion</strong> reports provide information such as slope, drift, exposure, substrate, and vegetation that relate to the current state of beach erosion within your site. </p>
                <p><strong>Shoreline Use</strong> reports provide information on land use and infrastructure for your site. </p>
                <p><strong>Public Access</strong> reports provide information about land use and beach access within your site. </p>
                <p><strong>Aquaculture</strong> reports provide information about oyster tracts and reserves, as well as commercial growing and harvest areas within your site. </p>
            </div>
        </div>
        
    </div>

{% endblock panel %}
